﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PhysicalExamination5.Model.DataMaintenance
{
    public class KeShiItemDataTreeClass
    {
        public string strCode {  get; set; }
        public string strName { get; set; }
        public string strType {  get; set; }
        public List<ItemDataTreeClass> children { get; set; }
    }
    public class ItemDataTreeClass
    {
        public string strCode { get; set; }
        public string strName { get; set; }
        public List<ItemDataTreeClass> children { get; set; }
    }
    public class ChangJianJieGuoTreeClass
    {
        public string strCode { get; set; }
        public string strName { get; set; }
        public string strBiaoXian { get; set; }
        public string strZhenDuan { get; set; }
        public List<ChangJianJieGuoTreeClass> children { get; set; }
    }
    public class ChangJianJieGuoTreeNodeClass
    {
        [Required(ErrorMessage ="科室ID是必填项！")]
        public string strKeShiId { get; set; }
        [Required(ErrorMessage ="组合项目ID是必填项！")]
        public string strZuHeXiangMuId {  get; set; }
        [Required(ErrorMessage ="明细项目ID是必填项！")]
        public string strMingXiXiangMuId { get; set; }
        public string strChangJianJieGuoId { get; set; }
        [Required(ErrorMessage = "常见结果名称是必填项！")]
        public string strChangJianJieGuoName { get; set; }
        public string strShiFouYangXing { get; set; }
        public string strShiFouXiaoJie { get; set; }
        public string strShiFouMoRen { get; set; }
        public string strBiaoXian { get; set; }
        public string strZhenDuan { get; set; }
        public string strShangJiJieDianId { get; set; }
        public bool Validate(string strType, out string strFanHuiZhi)
        {
            bool isSuccess = true;
            strFanHuiZhi = "";
            List<string> Message = new List<string>();
            switch (strType)
            {
                case "Add":
                    if (string.IsNullOrEmpty(strShangJiJieDianId))
                    {
                        strFanHuiZhi = "上级结点ID是必填项！";
                    }
                    break;
                case "Update":
                    if (string.IsNullOrEmpty(strChangJianJieGuoId))
                    {
                        Message.Add("常见结果ID是必填项！");
                    }
                    break;
            }
            
            if (Message.Count > 0)
            {
                isSuccess = false;
                strFanHuiZhi = string.Join("、", Message);
            }
            return isSuccess;
        }
    }
    public class ChangJianJieGuoTreeDeleteNodeClass
    {
        [Required(ErrorMessage ="科室ID是必填项！")]
        public string strKeShiId { get; set; }
        [Required(ErrorMessage ="组合项目ID是必填项！")]
        public string strZuHeXiangMuId { get; set; }
        [Required(ErrorMessage ="明细项目ID是必填项！")]
        public string strMingXiXiangMuId { get; set; }
        [Required(ErrorMessage = "常见结果ID是必填项！")]
        public string strChangJianJieGuoId { get; set; }
        public int iShunXu { get; set; }
        public bool Validate(out string strFanHuiZhi)
        {
            bool isSuccess = true;
            strFanHuiZhi = "";
            List<string> Message = new List<string>();
            if (iShunXu == 0)
            {
                Message.Add("顺序字段错误！");
            }
            if (Message.Count > 0)
            {
                isSuccess = false;
                strFanHuiZhi = string.Join("、", Message);
            }
            return isSuccess;
        }
    }
}
